Getting Help

Getting Help with CuteFTP Pro's Transfer Engine

Welcome to the GlobalSCAPE Online Help Desk! We have a variety of services available to help you with questions regarding our software. Extensive Web-based support is available to all users free of charge. E-mail support is available free of charge for 60 days from purchase.

Transfer Engine Help

Use the Contents, Index or Search tabs on the left to find answers.

Online Knowledge Base

Find help on the web in our online Knowledge Base

Customer Service

If you are having trouble downloading, installing or registering our products, customer service representatives are available to assist you by telephone at 210-308-8267 or send them an e-mail.

Lost Serial Number

If you are having problems registering your product because of a lost serial number and would like it re-sent, please click here, and your serial number will automatically be e-mailed to you in minutes!

Technical Support

Registered users may contact our Technical Support Team within 60 days of purchasing any of our software. Inquiries are handled in the order in which they are received and we do our best to reply promptly during regular business hours (8 A.M. to 6 P.M., Monday - Friday, Central Time).

Comprehensive Support Programs

If you would like ongoing technical support after the complimentary 60-day period, GlobalSCAPE offers programs to aid in your professional development and help you get the most out of your investment.

Thank you for using GlobalSCAPE software!


About the Transfer Engine

What is the Transfer Engine?

Built on a modular design platform, CuteFTP Pro’s FTP Transfer Engine (TE) is completely independent of the main application’s interface. Control the TE either through the CuteFTP Pro GUI or through its industry standard COM (Component Object Model) interface using your favorite programming or scripting language, such as Visual Basic, Perl, ASP or JavaScript.

Unique to CuteFTP Pro’s TE SDK are powerful encryption properties that dictate how the control and data channels communicate with the FTP server. From SSL to S/key or SSH2, the CuteFTP Pro TE SDK covers all your secure file transfer needs.

Benefits of the Autonomous Transfer Engine

The Transfer Engine:

  • Is COM enabled

  • Takes up minimal resources

  • Handles background transfers

  • Handles transfers outside the main interface

  • Handles continuous folder synchronization events

To access the Transfer Engine

By right-clicking on the TE icon located in the system tray, you will be able to access the current download queue (only visible if the main program interface is closed), restore the main program interface, close the TE, and paste in an FTP URL to download..

CuteFTP Pro relies on two executables for file transfers, cftppro.exe and ftpte.exe. Cftppro.exe is the GUI and ftpte.exe is the Transfer Engine (TE) program. The TE may be controlled by the GUI or through its industry standard Component Object Model (COM) interface using your favorite programming or scripting language, such as Visual Basic, Perl, ASP or JavaScript.

Capabilities

The Pro TE exposes most of the popular commands previously accessibly only through the application’s main interface.

Some of the actions you can accomplish use the Pro TE:

  • Login to and FTP server over a defined port

  • Login using an encrypted authentication mechanism, such as OTP

  • Login and transfer files using industry standard SSL (explicit & implicit modes supported)

  • Login and transfer files using SSH2

  • Login to sites through Firewalls, Socks or Proxy servers

  • Transfer files one at a time or simultaneously

  • Transfer files using multi-part transfers to increase throughput

  • Transfer files from one remote site to another

  • Transfer files using a wildcard mask

  • Transfer files obtained from server-side links

  • Perform folder synchronization tasks

  • Check on an item’s transfer status

  • Much more


TE licensing requirements

There are two ways the TE may be licensed:

  • With CuteFTP Pro. The TE is a component of CuteFTP Pro, therefore any computer with a licensed copy of CuteFTP Pro can access the TE through the GUI or through its COM interface.
  • Without CuteFTP Pro. If you wish to use the TE without the CuteFTP Pro interface i.e. redistribute it in an application you have developed, please contact our sales team to obtain a copy of the TE SDK and licensing requirements.


Setting up and registering the Transfer Engine

After you have installed CuteFTP Pro, including the Pro Interface and Transfer Engine (TE), you will need to run the TE once either directly or by launching the Pro Interface, before calling it from a script. This will register the TE COM component on your system.

To register the TE manually when the main interface is not installed

  1. Locate the CuteFTP Pro folder

  2. Navigate to the TE subfolder

  3. Double-click on the file named "ftpte.exe"

  4. Exit the TE by right-clicking on the TE icon in your Systray

To register it manually when the main interface is installed

  1. Locate the CuteFTP Pro program icon on you Desktop or Start menu

  2. Double-click on the CuteFTP Pro program icon

  3. Close CuteFTP Pro a few seconds after it launches

To register it on early version of Widows 95

  1. Locate the CuteFTP Pro folder

  2. Navigate to the TE subfolder

  3. Unzip the file called "nnnnn.zip"

  4. Right-click on the file "nnnnn.reg" and select "Edit" from the menu

  5. Adjust the paths to reflect where you installed CuteFTP Pro to

  6. Save any changes made to nnnn.reg

  7. Double-click on nnnn.reg and click Yes at the prompt

Once the TE is registered, you can create script files that will interface to it. If you don’t have much programming experience, use one of the template scripts included with this install, modifying it to suit your needs. Most of this document, including the various samples and glossary, are geared toward the non-programmer.

In order to run script files, you must have the Windows Scripting Host (WSH). WSH relies on the Visual Basic Script and JavaScript engines provided with Internet Explorer 3.0 or later. WSH is also installed as a part of Windows 98, Windows 2000, and Internet Information Server 4.0. A separate setup program can be downloaded for Windows 95 from: www.microsoft.com/msdownload/vbscript/scripting.asp.


Creating scripts
You can interact with the TE directly from your own custom applications using common programming languages such as Visual Basic (VB) or in a scripting language supported by the Windows Scripting Host (WSH).

You can create a script from the development IDE of your choice, or you can create scripts from within CuteFTP Pro by selecting Tools > Macros & Scripting > New Script. CuteFTP Pro will open a template script file in a document window.

To create a new script file, you need to have some familiarity with programming concepts and, ideally, some experience with VB or Java. For those of you who have neither, or just want a template to work from, load one of the predefined scripts included with CuteFTP Pro or the TE SDK and edit it to suit your needs. A few sample scripts are included in this document. Comments may be included in the code by prefacing comment lines with a single-quote character: ‘
Related topics

Reading the script examples

Method examples

Property examples


Reading the script examples

You can understand the examples, knowing what different symbols and font colors signify.

  • Read maroon text as the syntax for a method or property

  • Read "Bold font in double quotes" as parameters for a method or property

  • Read red text as the method or property within an example script

  • Read 'any words after an apostrophe or single quote mark as comment that will not affect the script

  • Read [Square brackets] as a place for optional items. Type the option, but not the brackets. Here's an example:

    • The syntax says;

String Object.Option("[option name]") = true | false

    • In a program type it like this

MySite.Option("FilterDirs")=False

    • Don't type it like this

MySite.Option("[FilterDirs]")=False


Using methods, properties and wildcards

Use methods and properties to operate the TE. Methods and properties are defined below.

Methods

A method can be described as a command or function that may accept arguments (parameters) and may return a certain type of value.

Example

Boolean Object.LocalExists(BSTR bstrName);

For this method, the type of the return value is Boolean. The command accepts an argument as a string value, here shown as BSTR (the type) and bstrName (a place holder for the argument).

In a program, you can execute a method and assign the return value to a variable all in one command.

Example

Exists = MySite.LocalExists "c:\temp\file.txt"

The argument "c:\temp\file.txt exists" is passed to the method LocalExists as a string (reason for the quotes). The variable Exists is then populated with a 1 or a 0 which is, in essence, true or false. You can then perform actions in your script based on those results.

Properties

A property is simply an attribute of a function (another word for method) or object internal to the TE framework. All properties have default values. Methods that rely on these properties will use default values unless you specify otherwise.

Most of the time, you can assign a value to a property or retrieve its value into a variable. You can set a property much like a local variable to your script.

Example

String Object.Protocol

The above property can accept a predefined set of string values or can be assigned to a variable to retrieve the currently selected value. The default in this case is “FTP”.

You can assign a value to a property as follows:

Example

MySite.Protocol = “FTPS”

Upon subsequent connections, the TE will attempt to login using FTP over SSL, rather then via FTP, the default attribute for this property.

Wildcard masks

Wildcard masks are patterns of special characters used to filter file names. When a wildcard mask is matched against a file name, the two patterns are compared, letter-by-letter, from left to right until a mismatch occurs. If all the characters in both patterns compare positively, the file name matches the Wildcard Mask.

Related topics

Finding a method

Finding a property

Using wildcard masks


Connecting with a script

Using a script to connect to a remote site

This script will connect the TE to the public GlobalSCAPE FTP server and display the words Connected OK in a message box when the connection is successful.

Set MySite= CreateObject("CuteFTPPro.TEConnection")

MySite.Option ("ThrowError") = False

MySite.Protocol = "FTP"

MySite.Host = "ftp.cu45646ftp.com"

if cbool(MySite.Connect) then

MsgBox "Connected OK"

else

MsgBox MySite.ErrorDescription

end if

Related topics
Connect
Finding methods

Finding properties


Downloading with a script

Using a script to download

This script will connect to the GlobalSCAPE FTP site and download a file called 'index.txt' to two local folders; c:/temp1 and c:/temp2.

Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Host = "ftp.globalscape.com"
MySite.Connect 'Recommended: call connect first
'next line changes to a predetermined folder so I can use a relative path in the download method
MySite.RemoteFolder = "/pub/cuteftp"
MySite.LocalFolder = "c:\temp1"
MsgBox (MySite.RemoteFolder) 'display current remote folder
MySite.Download "index.txt"
MySite.Download "index.txt", "c:\temp2\index.txt"
'now verify that it downloaded okay
If MySite.LocalExists ("c:\temp1\index.txt") Then
MsgBox "File1 downloaded OK."
End If
If MySite.LocalExists ("c:\temp2\index.txt") Then
MsgBox "File2 downloaded OK."
End If
MsgBox "Done"
Related topics

Connect

D ownload

Finding methods

Finding properties


Uploading with a script

Using a script to upload a file

Example 1

Use this script to upload all the files in a folder to a remote folder. This script will prompt the user for the host name, the remote folder, and the local folder.

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Protocol = "FTP"

MySite.Host = InputBox("Enter target host:", "CuteFTP Pro", "<your host

name>")

if not MySite.Host = "" then

MySite.Login = InputBox("Enter Login Name:", "CuteFTP Pro", "<your login

name>")

MySite.Password = InputBox("Enter Passwrd:", "CuteFTP Pro", "<your

password>")

MySite.Connect 'Recommended: call connect first

'prompt remote folder name

MySite.RemoteFolder = InputBox("Enter remote target folder:", "CuteFTP Pro",

"<your remote folder name>")

'prompt local folder name

MySite.LocalFolder = InputBox("Enter local source folder:", "CuteFTP Pro",

"<your local folder name>")

'using relative path, all files in local folder are uploaded to the remote

folder

MySite.Upload "*.*"

end if

MsgBox "Done"

Example 2

Modify this script to connect to a specific site and upload a specific

file.

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Protocol = "FTP"

MySite.Host = "ftp.ftp.net"

MySite.Login = "username"

MySite.Password = "password"

MySite.Connect

MySite.RemoteFolder = "Enter remote target folder"

MySite.LocalFolder = "c:\temp2\"

MySite.Upload "\index.txt"

MsgBox "Done"

Related topics

Connect

Upload

Finding methods

Finding properties


Finding a method alphabetically

AbortAsync | RemoteCommand
Close | RemoteExists
Connect | RemoteRemove
CreateLocalFolder | RemoteRename
CreateRemoteFolder | S2Sxfer
Disconnect | Synchronize
Download | TECommand
DownloadAsync | TransferURL
Error Handling | TransferURLAsync
GetList | Upload
LocalExists | UploadAsync
LocalRemove | Wait
LocalRename | WriteToLOG

Related topics

Finding a method by category

Finding a property alphabetically


Finding a method by category

Here you can link to every method listed in the help file.

Connection | Files and Folders
Connect | CreateLocalFolder
Disconnect | LocalExists
Close | LocalRename
 | LocalRemove
Transfer | CreateRemoteFolder
Upload | RemoteExists
Download | RemoteRename
S2Sxfer | RemoteRemove
Synchronize |
TransferURL | Commands
 | AbortAsync
Asynchronous Transfer | RemoteCommand
UploadAsync | TECommand
DownloadAsync | Wait
TransferURLAsync | WriteToLOG

Related topics

Finding a method alphabetically

Finding a property by category

Finding a property alphabetically


Connecting to a remote server

Description
Use the Connect method to log in to the remote server. Before calling it, you set the protocol, host address, user name, and password to establish a successful connection.
Syntax
Object.Connect
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.ftp.net"
MySite.Login = "username"
MySite.Password = "password"
MySite.Connect
Notes

Any time you call a Transfer function, the connect function is called indirectly. It is recommended you explicitly invoke the Connect function though it is not necessary. You can always use the IsConnected property to determine whether you are connected at any given time.

Related topics

Other methods


Downloading files

Description
Use the Download method to transfer a file or folder from a remote location to your local hard drive.
Syntax
Object.Download (BSTR strRemoteName ,BSTR strLocalName , long nMultiPartNumber)
Parameters
strLocalName | This is optional, use it only if you want to change the destination name or path for the downloaded files or folder. You can use absolute or relative paths with or without wildcards.
strRemoteName | This is the path to the remote item you are downloading. You can use absolute or relative paths with or without wildcards.
nMultiPartNumber | Use this to split the download into multiple parts. The default value = 1. The value specifies the number of parts used for the download.
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Specify user, pass, host, and connect as normal...
MySite.Connect ‘Recommended: call connect first
‘next line changes to a predetermined folder so you can use a relative path in the download method
MySite.RemoteFolder = "/c:/Inetpub/ftproot/Temp/Temp/"
MsgBox (MySite.RemoteFolder) 'display current remote folder
MySite.Download "agent.ini", "c:\temp\agent1.ini"
'now verify downloaded ok
If CBool(MySite.LocalExists ("c:\temp\agent1.ini")) Then
MsgBox "File downloaded OK."
End If
Notes

Setting the Multi-part download attribute can greatly increase the transfer speed for larger files under certain conditions. For example, the site must support multiple concurrent connections from the same user and you must have significant bandwidth.

The Download method is a syncrhonous command, meaning it must finish executing before subsequent commands in your script can be called. Use the method DownloadAsync (which also supports Multi-part transfers) to asyncrhonously download files, which allows you to execute the rest of the script while the download(s) take place.

Related topics

Other methods


Uploading files

Description
Use the Upload method to transfer a file or folder from a local hard drive to a remote server. T
Syntax
Object.Upload(BSTR strLocalName ,BSTR strRemoteName , long nMultiPartNumber)
Parameters
strRemoteName | This is optional, use it only if you want to change the destination name or path for the uploaded files or folders. You can use absolute or relative paths with or without wildcards.
strLocalName | This is the path to the local item you are uploading. You can use absolute or relative paths with or without wildcards.
nMultiPartNumber | Use this to split the upload into multiple parts. The default value = 1. The value specifies the number of parts used for the download.
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Specify user, pass, host, and connect as normal...
MySite.Connect ‘Recommended: call connect first
MySite.RemoteFolder = "Temp"
MySite.LocalFolder = "C:\123"
‘using relative path, all files in folder 123 are uploaded to the folder Temp off the current folder on the server.
MySite.Upload "*.*"
Notes

You can only use multi-part uploads with servers that support the COMB command. Currently, only GlobalSCAPE Secure FTP server supports the COMB command.

Setting the Multi-part upload attribute can greatly increase the transfer speed for larger files under certain conditions. For example, the site must support multiple concurrent connections from the same user and you must have significant bandwidth.

The Upload method is a syncrhonous command, meaning it must finish executing before subsequent commands in your script can be called. Use the method UploadAsync (which also supports Multi-part transfers) to asyncrhonously upload files, which allows you to execute the rest of the script while the upload(s) take place.

Related topics

Other methods


Transferring from URLs

Transferring from a URL

Description
Use the TransferURL method to download files directly from a Web address.
Syntax
Object.TransferURL(BSTR bstrRemoteName, long nMultipartNumber)
Parameters
bstrRemoteName | This is a string value for the URL for the file transfer such as; (ftp://ftp.globalscape.com/pub/cuteftp/cuteftp.exe).
nMultipartNumber | This is optional and will split a file into parts for transfer. The default = 1.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.TransferURL "ftp://ftp.globalscape.com/pub/cuteftp/cuteftp.exe"
The TE recognizes these URL formats:
ftp://user:pass@ ftp.sitename.com:port
ftp://user:pass@ ftp.sitename.com
ftp://user@ ftp.sitename.com
ftp:// ftp.sitename.com:port
ftp:// ftp.sitename.com
ftp://ftp.sitename.com/pub l: user p: pass ß l: user is a lowercase "L", not "one"
ftp://ftp.sitename.com/pub:44 l: user p: pass
ftp://ftp.sitename.com/pub port:44 l: user p: pass
ftp://ftp.sitename.com/pub l/p: user/pass
ftp://ftp.sitename.com/pub:44 l/p: user/pass
ftp://ftp.sitename.com/pub p:44 l/p: user/pass
ftp://ftp.sitename.com/pub port:44 l/p: user/pass
ftp://ftp.sitename.com/pub l: user p: pass
ftp://ftp.sitename.com/pub:44 l: user p: pass
ftp://ftp.sitename.com/pub p:44 l: user p: pass
ftp://ftp.sitename.com/pub port:44 l: user p: pass
Related topics

Other methods


Creating a local folder

Description
Use the CreateLocalFolder method to create a new folder (directory) on your local hard drive.
Syntax
Object.CreateLocalFolder(BSTR strName)
Parameters

BstrName

This contains the folder's relative or absolute path.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.CreateLocalFolder "c:\temp\New Folder"
'now check to see if it was created
MySite.LocalFolder = "c:\temp\New Folder"
currentdir = MySite.LocalFolder
MsgBox currentdir
Related topics

Other methods


Creating a remote folder

Description

Use the CreateRemoteFolder method to create a new folder (directory) on a remote server.

Syntax
Object.CreateRemoteFolder(BSTR strName)
Parameters

BstrName

This contains the folder's relative or absolute path.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.Connect
MySite.CreateRemoteFolder("/dir") ‘creates /dir (because absolute path was used)
MySite.RemoteFolder = "/dir" ‘now change to the newly create ‘dir’ folder
MySite.CreateRemoteFolder("dir2") ‘creates /dir/dir2 (because relative path was used)
Related topics

Other methods


Renaming a remote file or folder

Description
Use t he RemoteRename method to rename a file or folder on the remote server.
Syntax
Object.RemoteRename(BSTR bstrFrom, BSTR bstrTo)
Parameters
BstrFrom | This contains the folder's old name in a relative or absolute path. The path must be the same in both parameters.
BstrTo | This contains the folder's new name in a relative or absolute path. The path must be the same in both parameters.
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

‘Initialize all necessary fields for MySite : host name, user, password,

etc.

MySite.RemoteRename "/pub/user1/file.txt", "/pub/user1/file3.txt"

Related topics

Other methods


Renaming a l ocal file or folder

Description

Use t he LocalRename method to rename a file or folder on your local hard disk.

Syntax

Object.LocalRename(BSTR bstrFrom, BSTR bstrTo)
Parameters
BstrFrom | This contains the folder's old name in its full absolute path.
BstrTo | This contains the folder's new name in its full absolute path.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.LocalRename "c:\file.txt", "e:\temp\users\file.exe"

Note

Make sure you specify the full source and destination path. If you had written the command as MySite.LocalRename "c:\file.txt", “file.exe”, thinking it would rename it using relative paths, you might be surprised to find that your file has been moved to your profiles folder (system dependent). In essence, the LocalRename is similar to a MOVE command issued through drag and drop with the added name change sequence.
Related topics

Other methods


Deleting a remote file or folder

Description
Use t he RemoteRemove method to delete a remote file or folder. You can specify the file or folder with absolute or relative paths. If the command fails, make sure you have specified the correct path and that you have the appropriate permissions required to delete the item.
Syntax
Object.RemoteRemove(BSTR bstrName)
Parameters

BstrName

This contains the folder's relative or absolute path.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.RemoteRemove "/pub/user1/file.txt"
MySite.RemoteRemove("file.ext") ‘removes if exact match
MySite.RemoteRemove("*.obj") ‘wild card match with a specific extension
MySite.RemoteRemove("*.aaa" & Chr(10) & "*.bbb" & Chr(10) & "t*") ‘various wildcard filters
Related topics

Other methods


Deleting a local file or folder

Description
Use t he LocalRemove method to delete a local file or folder. Use the absolute path name for the item you want to delete.
Syntax
Object.LocalRemove(BSTR bstrName)
Parameters

BstrName

This contains the items full absolute path.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.LocalRemove "c:\temp\file.txt"
Notes
You can also you wild cards to replace the string value of bstrName. These wild card masks include "*", "?", and ‘\n" (new line symbol, also known as Chr(10) in VB)
Example 2
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.LocalFolder = "c:\temp"
MySite.LocalRemove("file.ext") ‘removes if exact match
MySite.LocalRemove("*.obj") ‘wild card match with a specific extension
MySite.LocalRemove("*.aaa" & Chr(10) & "*.bbb" & Chr(10) & "t*") ‘various wildcard filters
Related topics

Other methods


Retrieving a folder listing

Description

Use the GetList method to download folder listings.

Syntax

Object.GetList(BSTR bstrPath, BSTR bstrLocalFile, BSTR bstrFormat, BOOL *pVal)

Parameters
bstrPath | The remote path to be listed. Leave it empty if its the current path.
bstrLocalFile | Specifies a local file name where the listing can be saved.
bstrFormat | Can be used to format the listing. If left empty, a raw listing will be returned. You can specify %NAME, %DATE, and %SIZE as return values in a string.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com/pub"

MySite.Connect

MySite.GetList "", "c:\temp_list.txt" 'saves a raw listing for the default path to the file temp_list.txt

MsgBox MySite.GetResult 'retrieves and displays the listing

Example 2

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com"

MySite.Connect

MySite.GetList "/pub", "", "FILE NAME: %NAME" 'goes to pub folder, doesn't save the listing to file, and formats it as shown

MsgBox MySite.GetResult 'retrieves and displays the listing

Example 3

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com"

MySite.Connect

MySite.GetList "/pub", "", "NAME= %NAME SIZE= %SIZE DATE= %DATE" 'goes to pub folder, doesn't save the listing to file, and formats it as shown

MsgBox MySite.GetResult 'retrieves and displays the listing

Note

GetResult is an optional method used only with GetList. It simply retrieves the data. Without GetResult the data is written to the buffer, or if defined in the parameters, the data is written to the log.


Checking for a remote file or folder

Description
Use t he RemoteExists method to verify that a remote file or folder exists. BstrName should be the full path.
Syntax
Boolean Object.RemoteExists(BSTR bstrName)
Parameters
Return values
true | File or folder does exist
false | File or folder does not exist
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
R = MySite.RemoteExists( "/pub/user/file.txt")
If (R) Then
MsgBox "File exists on remote side"
Else
MsgBox "File doesn’t exist on remote side"
End if
Note

If using an "if not" conditional, use CBool instead of boolean as the return type.

Correct:

if not CBool(MySite.RemoteExists(strRemote)) then

MsgBox "Error! " & MySite.ErrorDescription

Incorrect:

if not MySite.RemoteExists(strRemote) then

MsgBox "Error! " & MySiteErrorDescription

Related topics

Other methods


Checking for a local file or folder

Description
Use t he LocalExists method to verify that a local file or folder exists. BstrName should be the full path.
Syntax
Boolean Object.LocalExists(BSTR bstrName);
Parameters
Return values
True | File or folder does exist
False | File or folder does not exist
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
L = MySite.LocalExists("c:\temp\file.txt")
If (L) Then
MsgBox "File exists on local side"
Else
MsgBox "File doesn’t exist on local side"
End if
Related topics

Other methods


Handling errors

Error Handling

You can capture and deal with errors differently in the various programming and scripting languages. An example for dealing with errors in Visual Basic Scripting, and one using a Transfer Engine property are provided below. You can use these for capturing an error message after a certain command fails and then handle the error appropriately.
Note
Each method may return an error during execution. In order to catch such errors you should use "On Error" VB statements. There are 2 types of this statement in VB script.
Visual Basic Syntax
On Error Resume Next
On Error GoTo 0
Visual Basic Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
'setup various properties here
MySite.Host = "bad.host.name"
On Error Resume Next
MySite.Connect
Err.Raise 6 ' Raise an overflow error.
MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description
Err.Clear ' Clear the error.
Transfer Engine Error Handling Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
'setup various properties here
MySite.Host = "bad.host.name"
MySite.Option("ThrowError") = false
if not CBool(MySite.Connect) then
MsgBox "Error : " & MySite.ErrorDescription
end if
Notes

The Option property is fully described in Setting or retrieving other settings.

Related topics

Other methods


Sending commands to the TE

Sending commands to the Transfer Engine

Description
Use t he TECommand method to pass various commands to the Transfer Engine component. If you leave the Transfer Engine running for a long time, it is recommended you include the DeleteFinished or DeleteAll in your scripts to occasionally empty the queue. The Transfer Engine does not empty the queue automatically.

Syntax
Object.TECommand(BSTR bstrParameter)
Parameters
"CLOSE" or "EXIT" | Closes the TE (all tasks will be stopped)
"EXITNOPENDING" | Closes the TE if no pending tasks are available
"UPDATESETTINGS" | Reloads settings from the registry (Note you can modify the registry from VBS)
"DELETEFINISHED" | Removes finished items from queue
"DELETEALL" | Removes all items from queue

Note
You can use any number of spaces or underscores inside these parameters. For example, "update setting" and "_UPDATE_SETTINGS_" are the same.

If the Transfer Engine has several tasks, or must run for a long time, you should include the DeleteFinished command in your scripts to occasionally clear items from the queue.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.TECommand("delete finished")
Related topics

Other methods


Sending commands to the server

Sending commands to a server

Description
Use t he RemoteCommand method to send the server any supported command. This function acts like the raw input command found in CuteFTP Pro.

Syntax
Object.RemoteCommand(BSTR bstrCmd)
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.RemoteCommand "PWD" ‘sends a print working directory command
Note

If you include the word "LIST", or "RETR", or "STOR" in bstrCmd then Pro will open the data connection, perform the operation (to the buffer) and then discard it. You should use the GetList, Download or Upload methods to accomplish these tasks.

You can concatenate strings to perform custom commands. For example, if you wanted to do use CHMOD on a file, you could do as shown in the example below:

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
strMODE = "777" ‘full permissions
strFile = InputBox("Type in the file name below ", "CHMOD Dialog", "cftppro10.log") ‘an input dialog with some default content
strvar = "SITE CHMOD " & strMODE & " " & strFile ‘concatenate the values
MySite.RemoteCommand strvar 'send the command
Related topics

Other methods


Synchronizing folders

Description
Use t he Synchronize method to make the contents of a remote folder and a local folder the same. Both must use absolute path names. Refer to the main help documentation for more information on CuteFTP Pro’s directory synchronization feature.

Syntax
Object.Synchronize(BSTR bstrRemoteName, BSTR bstrLocalName, long nDirection, long nAction, long nCasehandling, BOOL bRecursive, BOOL bIgnoreLinks, BOOL bDelDestination, BOOL bPromptDel);

Parameters

BSTR:

bstrRemoteName | Absolute path to the remote folder
bstrLocalName | Absolute path to the local folder

nDirection:

0 | Mirror Local (make the remote look just like the local side - upload)
1 | Mirror Remote (make the local look just like the remove side - download)
2 | Mirror Both

nAction for Mirror Local and Mirror Both:

0 | Use Global Overwrite settings in the Pro shell for matching filenames
1 | Always overwrite the file with a matching name
2 | Numerate the file (filename[1])
3 | Skip

nAction for Mirror Both:

0 | Mirror recent files
1 | Mirror bigger files
2 | Prompt for matching file names
3 | Skip mirroring files with the same names

nCasehandling:

0 | Only first (default)
1 | Prompt
2 | Numerate

bRecursive:

true (default) | Apply sync to subfolders
false | Don't sync subfolders

bIgnoreLinks:

true (default) | Ignore symbolic links
false | Don't ignore symbolic links

bDelDestination:

true (default) | Remove destination if source doesn’t exist
false | Don't remove destination

bPromptDel:

true (default) | Prompt before removing destination
false | Don't prompt

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

‘Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.Connect

MySite.Synchronize "/pub/myfolder", "C:\mysitesfiles", 0, 1

Related topics
Other methods


Transferring from site to site (FXP)

Description
Use the S2Sxfer method to transfer a file from one remote site to another. You must use absolute path names for the source and target folders.
Syntax
Boolean Object.S2Sxfer(BSTR bstrSourceName, BSTR bstrDestName, BSTR bstrPeerHost, BSTR bstrPeerLogin, BSTR bstrPeerPassword, long Port, BSTR bstrPeerProtocol);
Parameters
bstrSourceName | source file and folder name
bstrDestName | target file and folder name
bstrPeerHost | target host name
bstrPeerLogin | target login
bstrPeerPassword | target password
Port | target port
BstrPeerProtocol | target protocol (FXP can be applied for hosts with different protocols FTP, FTP-S)
Return values
true | Transfer was successful
false | Transfer failed
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

‘Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.Connect

MySite.S2Sxfer "/cftppro14.log", "/home/myfolder/cftppro14.log", "ftp.destinationhost.com", "username", "passwrd" 'everything else left as default

Related topics

Other methods

Finding servers that support FXP

Setting up servers for FXP


Writing to a log

Writing messages in a log

Description
Use the WriteToLOG method to write a messaged directly to the connection log saved in the path set in CuteFTP Pro's global options. It is useful for documenting events to aid in script debugging.
Syntax
Object.WriteToLOG(BSTR bstr , BSTR bstrType)
Parameters
bstr | The log message.
bstrType | A log message, type: "STATUS", "ERROR", "NOTE", "COMMAND", "RAW". The default is "STATUS".
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.TransferURLAsync "ftp://ftp.cuteftp.com/pub/cuteftp"
strResult = MySite.Wait
If (strResult = "FINISHED") then
MySite.WriteToLOG "Transfer successful!!"
MySite.WriteToLOG "Transfer successful!!", "error"
MySite.WriteToLOG "Transfer successful!!", "note"
End if
As result, the log will contain the following strings:
STATUS: > Transfer successful!!
ERROR: > Transfer successful!!
Note > Transfer successful!!
Related topics

Other methods


Waiting for a task to complete

Description
Use t he Wait method to tell the Transfer Engine to hold all other tasks until a specific asynchronous task is completed. Then continue with the rest of the script.

Syntax
String Object.Wait (long taskIndex, long timeout)
Parameters
taskIndex | This is the task index in the asynchronous tasks array. The default = -1 (which is current task). It can range from 0 to the total number of tasks minus one.
timeout | Determines how long (in milliseconds) to wait for a finished, cancelled, or errored status before continuing with the script.
Return value
"CANCELLED" | Transfer was stopped by the user
"FINISHED" | Transfer was successfully finished
"ERROR" | There were errors during the transfer
"SKIPPED" | The transfer was skipped (file overwrite rules)
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MySite.TransferURLAsync "ftp://ftp.cuteftp.com/pub/cuteftp"
strResult = MySite.Wait
If (strResult = "ERROR") then
MsgBox "warning! An error has occurred!"
End if
Related topics
Other methods


Stopping transfers and other events

Description
Use the Disconnect method to end an event in progress. It is normally used to stop a file transfer.
Syntax
Object.Disconnect()
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.TransferURLAsync
MySite.Disconnect
Notes
Disconnect is not the same as the standard FTP command QUIT. Instead it is simply a command to stop the current transfer task. You can issue a QUIT command prior to invoking Disconnect by using the RemoteCommand function.

A socket disconnect (more brutal than QUIT) to an FTP server occurs automatically after all transfers and other commands have finished. This is similar to the Connect command, which is implicitly called when a transfer method is invoked.

The example above uses the TransferURLAsync command to pass the TE an FTP file location to download. Since the TransferURLAsync command is asynchronous, you could called TransferURLAsync multiple times consecutively.

What happens if you issue a Disconnect command after issuing multiple TransferURLAsync commands? The last called TransferURLAsync request is the one that is cancelled.
Related topics

Other methods


Closing the Transfer Engine

Description
Use the Close function to exit the Transfer Engine. You can include parameters to only exit on certain conditions.
Syntax
Object.Close (BSTR bstrParameter)
Parameters
""(default empty), "CLOSE", "EXIT" | Closes TE (all tasks will be stopped)
"EXITNOPENDING" | Closes TE if no pending tasks available
Note
You can use any number of spaces or underscores inside these parameters. For example, "exit no pending" and "_EXIT_NO_PENDING_" are the same.
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.LocalFolder = "c:\temp"

MySite.TransferURLAsync "ftp://ftp.cuteftp.com/pub/cuteftp"

MySite.Close "EXITNOPENDING"

Related topics

Other methods


Uploading items asynchronously

Description

Use the UploadAsync method to upload a file or folder to a remote server asynchronously. An asynchronous upload starts and then returns control to the script before the transfer finishes. This allows you to perform many simultaneous transfers because the method does not wait for the upload to end.

Immediately after you call this method subsequent methods in your script will be called, so be careful when timing certain events.

If UploadAsync encounters a problem when trying to complete its task, it will not throw a COM, ATL, or VB error. UploadAsync will also adhere to your max global and per site settings.

Syntax
Object.UploadAsync(BSTR strLocalName [,BSTR strRemoteName [, long nMultiPartNumber]])
Parameters
strRemoteName | This is optional, use it only if you want to change the destination name or path for the uploaded files or folders. You can use absolute or relative paths with or without wildcards.
strLocalName | This is the path to the local item you are uploading. You can use absolute or relative paths with or without wildcards.
nMultiPartNumber | Use this to split the upload into multiple parts. The default value = 1. The value specifies the number of parts used for the download.
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

‘Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.Connect

MySite.UploadAsync "c:\temp\*.vob", "/DVDFiles" 'uploads as many .vob files as concurrent connection settings allow

Note

The Multi-part parameter for the UploadAysnc is currently limited to servers that support this operation, due to the need to recombine the files after the upload of each part has completed. As of September 2002, GlobalSCAPE’s Secure FTP server was the only server to support this function.

Related topics

Other methods


Downloading items asynchronously

Description

Use the DownloadAsync method to download a file or folder to the local hard drive asynchronously. An asynchronous download starts and then returns control to the script before the transfer finishes. This allows you to perform many simultaneous transfers because the method does not wait for the download to end. Immediately after you call this method subsequent methods in your script will be called, so be careful when timing certain events.

If DownloadAsync encounters a problem when trying to complete its task, it will not throw a COM, ATL, or VB error. DownloadAsync will also adhere to your max global and per site settings.

Syntax
Object.DownloadAsync(BSTR strRemoteName ,BSTR strLocalName , long nMultiPartNumber)
Parameters
strLocalName | This is optional, use it only if you want to change the destination name or path for the downloaded files or folder. You can use absolute or relative paths with or without wildcards.
strRemoteName | This is the path to the remote item you are downloading. You can use absolute or relative paths with or without wildcards.
nMultiPartNumber | Use this to split the download into multiple parts. The default value = 1. The value specifies the number of parts used for the download.
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp.cuteftp.com"

MySite.Connect

MySite.DownloadAsync "/pub/cuteftp/english/*", "c:\temp" 'downloads all files in the pub/cuteftp folder

Notes
You can call the DownloadAsync method many times sequentially in a script. Each call, in turn, opens a new data connection to the specified server, enabling you to transfer multiple files simultaneously. This, combined with the ability to transfer the file in multiple parts, greatly increases the overall transfer speed and execution of your task.
Related topics
Other methods


Downloading from URLs Asynchronously

Transferring from URLs asynchronously

Description
Use the TransferURLAsync method to start a download from a web address, and return control to the script immediately. This method does not wait for the transfer to end. You can use it to perform many simultaneous transfers.

The difference between this method and DownloadAsync is simply the ability to specify all of the necessary parameters in one command, rather than having to set the user name, port, host, etc. and then transfer a file.

Immediately after you call this method subsequent methods in your script will be called, so be careful when timing certain events.

If TransferURLAsync encounters a problem when trying to complete its task, it will not throw a COM, ATL, or VB error. TransferURLAsync will also adhere to your max global and per site settings. You can't use wildcards in this method.
Syntax
Object.TransferURLAsync(BSTR bstrURL [, long nMultipartNumber])
Parameters
bstrURL | A string value for the URL for the file transfer (ftp://ftp.cuteftp.com/pub/cuteftp)
nMultipartNumber | An optional multipart parameter with default = 1
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.TransferURLAsync "ftp://ftp.cuteftp.com/pub/cuteftp/english"

‘this will transfer the entire English CuteFTP directory from the CuteFTP.com ftp site.

Normal Formats Supported
ftp://user:pass@ ftp.sitename.com:port
ftp://user:pass@ ftp.sitename.com
ftp://user@ ftp.sitename.com
ftp:// ftp.sitename.com:port
ftp:// ftp.sitename.com
ftp://ftp.sitename.com/pub l: user p: pass ß l: user is a lowercase "L", not "one"
ftp://ftp.sitename.com/pub:44 l: user p: pass
ftp://ftp.sitename.com/pub port:44 l: user p: pass
ftp://ftp.sitename.com/pub l/p: user/pass
ftp://ftp.sitename.com/pub:44 l/p: user/pass
ftp://ftp.sitename.com/pub p:44 l/p: user/pass
ftp://ftp.sitename.com/pub port:44 l/p: user/pass
ftp://ftp.sitename.com/pub l: user p: pass
ftp://ftp.sitename.com/pub:44 l: user p: pass
ftp://ftp.sitename.com/pub p:44 l: user p: pass
ftp://ftp.sitename.com/pub port:44 l: user p: pass
Extended URL formats

Aside from the standard URL formats shown above, additional specifires may be used to denote the direction of transfer and download path. Use the extended format to perform site to site transfers, uploads, targeted downloads, and more.

The standard url ftp://user:pass@ftp.host.com will be used in the following examples:

Format: Normal URL transfer

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com"

'download site to the default download folder

Format: URL [space] "-->" [space] LPATH

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com --> c:\temp"

'download site to the c:\temp folder

Format: URL [space] "<--" [space] LPATH

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com <-- c:\web"

'upload files from c:\web to the site

Format: URL1 [space] "<->" [space] URL2

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com <->

ftp://user2:pass2@ftp.host2.com" 'perform a site to site transfer

Format: URL [space] "<==" [space] LPATH

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com <== c:\web"

'synchronize (mirror local) the c:\web folder to the site

Format: URL [space] "==>" [space] LPATH

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com ==> c:\web"

'synchronize (mirror remote) the site to c:\web

Format: URL [space] "<=>" [space] LPATH

Example: MySite.TransferURLAsync "ftp://user:pass@ftp.host.com <=> c:\web"

'synchronize both local and remote (mirror both)

Related topics

Other methods


Stopping asynchronous transfers

Description
Use the AbortAsync function to stop an asynchronous task created previously by UploadAsync, DownloadAsync or TransferURLAsync. Refer to those methods for more information.

Syntax
Object.AbortAsync(long taskIdx)

Parameters

TaskIdx

This is a task index in the array of tasks created by the various asynchronous methods. The default value of taskIdx is - 1 which specifies all the asynchronous tasks in array.

TaskIdx should be between 0 and AsyncTaskNumber minus one.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Option("CleanupAsync") = False

‘Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.Connect

MySite.DownloadAsync "*.*", "c:\temp"

MsgBox "Number of tasks created: " & MySite.AsyncTaskNumber

If MySite.AsyncTaskNumber > 10 then

MsgBox "Aborting 11th task"

MySite.AbortAsync ( 10 ) 'abort task # 11 (one less then total, since

starts from 0)

End if

Notes

You must set MySite.Option("CleanupAsync") = False so that all asynchronous tasks are counted. Otherwise, only the last asynchronous task launched will be referenced when calling the AbortAsync method.

Related topics

UploadAsync

DownloadAsync

TransferURLAsync


Finding a property alphabetically

Here you can link to any property listed in the Help file.

AsyncTaskNumber | Links | RemoteFilterInclude
AutoRename | LocalFilterExclude | RemoteFolder
ClearDataConnection | LocalFilterInclude | RemoteSiteFilter
CombSupport | LocalFolder | RestSupport
DataChannel | Log | Retries
Delay | Login | SocksInfo
ErrorDescription | MaxConnections | Speed
FileSize | Option | Status
FileTimeModified | Password | TimeElapsed
FileType | Port | TimeLeft
HomeDir | Protocol | TotalSize
Host | ProxyInfo | TransferredSize
IgnoreLinks | Recursive | TransferType
IsConnected | RemoteFilterExclude | UseProxy
IsPending |  |

Related topics

Finding a property by category

Finding methods alphabetically


Finding a property by category

You can find properties here listed by:

  • Connection properties

  • Read-only connection properties

  • Transfer properties

  • Read-only transfer properties

  • Filter properties

Connection properties
Protocol | ClearDataConnection
Host | Retries
Login | Delay
Password | Links
Port | LocalFolder
UseProxy | RemoteFolder
ProxyInfo | MaxConnections
SocksInfo | Option
DataChannel |

Read-only connection properties
IsConnected | HomeDir
ErrorDescription | Log

Transfer properties
TransferType | Recursive
LocalFolder | IgnoreLinks
RemoteFolder | Option
AutoRename |

Read-only transfer properties
AsyncTaskNumber | Speed
Combsupport | TimeLeft
IsPending | TimeElapsed
Status | FileType
RestSupport | FileSize
TotalSize | FileTimeModified
TransferredSize |
Filter properties
LocalFilterInclude | RemoteFilterInclude
LocalFilterExclude | RemoteFilterExclude
 | RemoteSiteFilter


Setting protocols

Description
Use the Protocol property to set or retrieve the value for the protocol type.
Syntax
String Object.Protocol
Parameters
"FTP" | File Transfer Protocol
"FTPS" | FTP using SSL in explicit mode (standard port 21)
"FTPS_IMPLICIT" | Extension of FTP using SSL -- FTP using SSL in implicit mode (specific port)
"SFTP" | Secure protocol based on SSH2
"FTP_SKEY_MD4" | Secure one time password login using MD4
"FTP_SKEY_MD5" | Secure one time password login using MD5
"HTTP" | Hypertext Transfer Protocol
"HTTPS" | HTTP with SSL
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTPS_IMPLICIT "
MySite.Host = "ftp.ftp.net"
MySite.Port = 990
MySite.Login = "username"
MySite.Password = "password"
MySite.Connect
Note
When using SSL, see also ClearDataChannel property for more options.
Related topics

Other properties


Transferring items in an unencrypted data channel

Transferring files in an unencrypted data channel

Description
Use the ClearDataConnection property to specify whether the data channel should be encrypted or not when using FTP over SSL.
Syntax
long Object.ClearDataConnection
Parameters
True | Your login is encrypted but data transfers are not. This is the default.
False | Your login and data transfers are encrypted.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTPS"
MySite.ClearDataConnection = false ‘encrypt FTP data channel
Notes
The default is true (encrypted), so only set this property if you wish to log in securely but transfer data in the clear.

This property will only work if the remote server supports SSL and clear data channel connections (PROT C command according to RFC 2228) and you have specified FTPS as the protocol type.

Related topics

Other properties


Setting the host address for a connection

Setting a host address for a connection

Description
Use the Host property to set or retrieve the value for the host name of a site when you are connecting.
Syntax
int Object.Host
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.ftp.net"
MySite.Port = 21
MySite.Login = "username"
MySite.Password = "password"
Related topics

Other properties


Setting the user name for a connection

Setting your user name

Description
Use the Login property to set or retrieve the value for the user name (login) you use to connect.
Syntax
String Object.Login
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.ftp.net"
MySite.Login = "username"
MySite.Password = "password"
MySite.Connect
Related topics

Other properties


Setting the password for a connection

Description
Use the Password property to set or retrieve the value for the password you use to connect.
Syntax
String Object.Password
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.ftp.net"
Object.Login = "username"
MySite.Password = "password"
MySite.Connect
Related topics

Other properties


Setting the port for a connection

Description
Use the Port property to set or retrieve the value for the Port on the server when you connect.
Syntax
int Object.Port
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Host = "ftp.ftp.net"
MySite.Port = 21
MySite.Login = "username"
MySite.Password = "password"
MySite.Connect
Related topics

Other properties


Connecting through a proxy or SOCKS server

Description
Use the UseProxy property to retrieve or set the value for the type of SOCKS or proxy server that is being (or should be) used. Since OFF is the default, you don't need UseProxy for regular connections which do not pass through proxy or SOCKS servers.
Syntax
String Object.UseProxy
Parameters
"OFF" | Direct connection without any socks and proxy
"SOCKS" | SOCKS server only - the user must specify the SOCKS parameters by setting the SocksInfo property
"PROXY" | Proxy server only - the user must specify the proxy server parameters by setting the ProxyInfo property
"BOTH" | Use both SOCKS and proxy - the user should specify the appropriate information for both the proxy and the socks server with ProxyInfo and SocksInfo.
Example
Object.UseProxy = "SOCKS" ‘specify that socks will be used, then configure SocksInfo
Object.SocksInfo = "socks5://globalscape.com:1080"
‘Rest of connection code follows...
Related topics

Other properties


Setting or retrieving proxy server configurations

Setting and retrieving proxy server configurations

Description
Use the ProxyInfo property to set or retrieve FTP and HTTP proxy server configurations. Do not use this function if you do not connect through a proxy server.
Authentication Parameters
"ftp://proxyusername:proxypassword@proxyhostname:proxyport" | For FTP proxies that require authentication.
"http://proxyusername:proxypassword@proxyhostname:proxyport" | For HTTP proxies that require authentication.
"ftp:// proxyhostname:proxyport" | For FTP proxies that don't require Authentication.
"http:// proxyhostname:proxyport" | For HTTP proxies that don't require Authentication.

Additional parameters
"proxyusername" | The user name for login to the proxy server
"proxypassword" | The password for login to the proxy server
"proxyhostname" | The proxy server address
"proxyport" | The proxy server connection port
Syntax
String Object.ProxyInfo
Example 1
MySite.ProxyInfo = http://globalscape.com:8000 ‘use http proxy without authorization
Example 2
MySite.ProxyInfo = ftp://joeuser:maypass@globalscape.com:21 ‘use ftp proxy with authorization for user "joesuser" & password "mypass"
Example 3
str = MySite.SocksInfo ‘retrieve the current value of SocksInfo (empty if none)
MsgBox str ‘now display it
Related topics

Other properties


Setting or retrieving values for SOCKS servers

Description
Use the SocksInfo property to set or retrieve values for SOCKS4 or SOCKS5 servers. (SOCKS is a protocol for a TCP proxy across firewalls.)
Syntax
String Object.SocksInfo
Authentication Parameters
"socks4://socksusername:sockspassword@sockshostname:socksport" | For SOCKS4 servers that require authentication.
"socks5://socksusername:sockspassword@sockshostname:socksport" | For SOCKS5 servers that require authentication.
"socks4:// sockshostname:socksport" | For SOCKS4 servers that do not require authentication.
"socks5:// sockshostname:socksport" | For SOCKS5 servers that do not require authentication.
Additional parameters
"socksusername" | The user name or log in name to the SOCKS server.
"sockspassword" | The password for the SOCKS server.
"sockshostname" | The address and port for the SOCKS server.

Example 1
MySite.SocksInfo = "socks4//globalscape.com:1080" " use socks4 without authorization
Example 2
MySite.SocksInfo = "socks5://joeuser:mypass@globalscape.com:1080" ‘use socks5 with authorization for user "joeuser" with password "mypass"
Example 3
str = MySite.SocksInfo ‘retrieve the current value of SocksInfo (empty if none)
MsgBox str ‘now display it
Related topics

Other properties


Choosing ASCII, binary, or auto transfer types

Description
Use t he TransferType property to retrieve or set the value for the way the Transfer Engine should transfer files (ASCII, binary or auto).
Syntax
String Object.TransferType
Parameters
"ASCII" | All files should be transferred in ASCII mode
"BINARY" | All files should be transferred in BINARY mode
"AUTO" (default) | The TE will reference an internal list editable from the CuteFTP Pro’s Global Options to determine the proper transfer type for that particular file. For example, if the ASCII list contains a filter mask of ".txt" then all files with extension ".txt" will be transferred in ASCII. If a file doesn’t correspond to any mask in this list then it will be transferred in binary mode.
Example
Object.TransferType = "AUTO" ‘the Transfer Engine will use the shell’s default settings to establish whether the transfer should occur in binary or ASCII. ‘write file transfer code next...
Related topics

Other properties


Choosing a PASV or PORT connection

Description
Use the DataChannel property to set or retrieve values for the method in which the data port is established for the data channel (PASV or PORT). The default is PORT.
Syntax
String Object.DataChannel
Parameters
"PORT" | The client specifies what port to use for the data connection
"PASV" | Lets the server specify the port used for the data connection port
"DEFAULT" | Uses the method defined in Global Options
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Host = "ftp://ftp.cuteftp.com"
MySite.useProxy = "off"
MySite.DataChannel = "PASV"
MySite.RemoteCommand("LIST")
MySite.DataChannel = "PORT"
MySite.RemoteCommand("LIST")
MsgBox MySite.Log
Related topics

Other properties


Setting the number of retry attempts

Description
Use the Retries property to retrieve or set the value for the maximum number of attempts the Transfer Engine should make to connect or transfer a file.
Syntax
int Object.Retries
Example
MySite.Retries = 10
Related topics

Other properties


Setting the delay between retries

Description
Use the Delay property to set the delay between connection or transfer retry attempts (in seconds).
Syntax
int Object.Delay
Example
MySite.Delay = 90
Related topics

Other properties


Resolving or retrieving links

Description
Use the Links property to both set and retrieve values for working with links on a remote server.
Syntax
String Object.Links
Parameters
"Resolve" | The TE will attempt to resolve the link prior to transfer.
"GetAsFile" | The TE will assume it’s a file and transfer as is (This is used to avoid endless loops in a large multi-directory transfer).
Example
MySite.Links = "Resolve"

Related topics

Other properties


Ignoring links

Description

Use the IgnoreLinks property when working with Unix servers. Use IgnoreLinks to set or retrieve the value that determines whether or not you want to bypass links.

Syntax

Bool Object.IgnoreLinks

Parameters
"True" | Skip symlinks during synchronization
"False" | Handle symlinks during synchronization as files or folders

Example

Mysite.IgnoreLinks = "False"

Related topics

Other properties


Choosing a local folder

Description
Use the LocalFolder property to retrieve or set the current folder on your local hard disk. You can use relative or absolute paths.
Syntax
String Object.LocalFolder
Example
Object.LocalFolder = "c:\temp"
Related topics

Other properties


Choosing a remote folder

Description
Use the RemoteFolder property to retrieve or set the current remote folder. You can use absolute or relative paths.
Syntax
String Object.RemoteFolder

Example
‘Connect to site following previous samples
MySite.RemoteFolder = "/pub/cuteftp" ‘Changes the remote folder to /pub/cuteftp (absolute paths used)
‘subsequently
MySite.RemoteFolder = "test" ‘Changes to the folder called "test" located in "/pub/cuteftp", using relative paths.
Related topics

Other properties


Using the AutoRename feature in transfers

Using the auto-renaming feature in transfers

Description
Use the AutoRename property to set or retrieve the renaming values prior to the transfer of a file or folder. To configure the auto-rename rules open the the CuteFTP Pro interface and go to Tools > Global Options > Transfer Settings > Rename Rules.
Syntax
String MySite.AutoRename
Parameters
"ON" | AutoRename feature turned on
"OFF" | AutoRename feature turned off
Example
MySite.AutoRename = "ON"
Related topics

Other properties


Setting the maximum number of connections

Description
Use the MaxConnections property to set or retrieve the most connections the script is allowed to open.
Syntax
long Object.MaxConnections
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.MaxConnections = 1 ‘restrict connections to 1
Related topics

Other properties


Choosing to include or exclude subfolders in a task

Description

Use the Recursive property to set or retrieve the value that determines whether or not subfolders will be included in a transfer task. This property is used often in synchronization scripts.

Syntax

Bool Object.Recursive

Parameters
"True" | Include subfolders
"False" | Do not include subfolders

Example

Mysite.Recursive = "True"

Related topics

Finding properties alphabetically

Finding properties by category


Setting or retrieving other settings

Description

Use the Option property to set or retrieve various settings, such as

Auto-rename, include folder names when filtering, cache invalidation, error

handling, and cleaning up of asynchronous tasks.

Syntax

String Object.Option("[option name]") = true | false

Parameters
"ThrowError" | (defaults to True) - TE COM will call AtlReportError (showing a VB runtime error message box) on connection/transfer/IO/other error which will terminate script execution. If set to False, then if some transfer method fails the script will continue to the next command.
"AutoRename" | (defaults to False) - The same as the AutoRename property.
"CleanupAsync" | (defaults to True) - All task IDs accumulated by previous Async methods will be lost. If set to False, all task IDs will be added to the ones created by previous Async methods.
"InvalidateCache" | (defaults to True) - Remove cached file (containing listings) before uploading, downloading, renaming or deleting files. If false, then don't remove cached listing. You can obtain the specific file information when needed by using one of the file property methods. InvalidateCache optimizes LIST traffic.
"FilterDirs" | (defaults to True) - Apply filters to folder names. If set to False, then don't apply.

Example 1

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp://ftp.cuteftp.com"

MySite.Option("FilterDirs")=False 'don't filter folder names

MySite.LocalFilterExclude= "TDImon; *.txt; *.vbs" 'now set the item names to exclude

MySite.Upload "c:\test" 'uploads all of test including sub dirs. Even sub

dirs that match the filter, such as TDIMon. If I had left FilterDirs=True,

then the folter TDImond would not have been uploaded.

Example 2

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Host = "ftp://ftp.somestrangedomain.com"

MySite.Option("ThrowError") = false

if not CBool(MySite.Connect) then

MsgBox "Error : " & MySite.ErrorDescription

end if

Related topics

Other properties


Checking for a connection

Description
Use the IsConnected property to indicate whether or not you are presently connected to the remote site.
Syntax
Boolean Object.IsConnected
Parameters
"True" | The Transfer Engine is currently connected to the server.
"False" | The Transfer Engine is not currently connected to the server.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
If Cbool(MySite.IsConnected) Then
MsgBox "Connected to server:" + MySite.Host
End if
Note
You can set how long the Transfer Engine will leave the data connection open after a completed transfer. Go to Tools > Global Options > Transfer Settings and set the time in Close the file transfer n seconds after the transfer is completed.
Related topics

Other properties


Retrieving the number of Asynchronous tasks

Description

Use the AsyncTaskNumber property to return the number of tasks created by the UploadAsync, DownloadAsync and TransferURLAsync methods.

Syntax
Long Object.AsyncTaskNumber
Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

‘Initialize all necessary fields for MySite : host name, user, password,

etc.

MySite.Option("CleanupAsync") = False

MySite.DownloadAsync "/path/*.*"

MsgBox "task number created" & MySite.AsyncTaskNumber

Notes

You must set MySite.Option("CleanupAsync") = False so that all asynchronous tasks are counted. Otherwise, only the last asynchronous task launched will be referenced when calling the AsyncTaskNumber property.

Related topics

Other properties


Checking if a server supports the COMB command

Checking if a server supports multi-part uploads

Description
Use the CombSupport property to check if the server supports the COMB (multi-part upload) command.
Syntax
Boolean Object.CombSupport
Return values
1 | Server supports COMB
0 | Server does not support COMB
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
If (not MySite.CombSupport) Then
MsgBox "This server doesn’t support the COMB command!"
End if
Related topics

Other properties


Retrieving error descriptions

Description
Use the ErrorDescription property to get the string describing the last error condition. It may consist of some messages taken from the transfer log.
Syntax
String Object.ErrorDescription (long taskIdx)
Parameter

TaskIdx

This is a task index in the array of tasks created by the various asynchronous methods. The default value of taskIdx is - 1 which specifies all the asynchronous tasks in array.

TaskIdx should be between 0 and AsyncTaskNumber minus one.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Option("ThrowError") = false ‘disable ATL exceptions
if cbool(MySite.Connect) then
MsgBox "Connected OK"
else
MsgBox "Error! " & MySite.ErrorDescription

Related topics

Other properties


Retrieving the server's home directory

Description
Use the HomeDir property to return a string value containing the name of the server’s home directory.
Syntax
String Object.HomeDir
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
MsgBox "Home dir for server " + MySite.Host + " is: " + MySite.HomeDir
Related topics

Other properties


Checking if a transfer is active

Description
Use the IsPending property to determine whether a transfer is active or if it is already finished with success or error. This can be useful in combination with async commands or during an interactive script. The IsPending property will return a value of either true or false.
Syntax
Boolean Object.IsPending(long taskIdx)
Parameter

TaskIdx

This is a task index in the array of tasks created by the various asynchronous methods. [0.. AsyncTaskNumber minus one, or - 1 (last asynchronous task started)]

This has a default value (if nothing is specified) of ALL tasks. Therefore, IsPending will return true if any task is still pending. It will return false if none are pending.

Example 1
Set MySite = CreateObject("CuteFTPPro.TEConnection")
'Regular connection code here:
MySite.Download inbound/*.*", "c:\temp"
If CBool(MySite.IsPending) Then
MsgBox "task is in working state" + MySite.Host
End if
Example 2
Here is another example that checks an asynchronous transfer and will return various transfer progress properties of each transfer while IsPending is true.

Warning: If you copy and paste this code, be aware that line breaks may be inserted into the code.

Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Protocol = "FTP"
MySite.Port = "21"
MySite.Host = "ftp.url"
MySite.login = "loginname"
MySite.Password = "your pass"
MySite.Connect

MySite.Option("CleanupAsync") = False

' line break
strNL = (Chr(13) & Chr(10))
MySite.MaxConnections = 3
MySite.Option("ThrowError") = false
MySite.DownloadAsync "inbound/*.*", "c:\temp"
bContinue = true
while CBool(MySite.IsPending) and bContinue
str = "LOOP, Total: " & MySite.AsyncTaskNumber & strNL
for i = 0 to MySite.AsyncTaskNumber - 1 step 1
str = str & i & ": size: " & MySite.TransferredSize(i) & ", speed: " & MySite.Speed(i) & ", time left: " & MySite.TimeLeft(i) & ", status: " & MySite.Status(i) & strNL
next
str = str & "YES - continue loop, NO - stop tasks, CANCEL - exit loop"
nUserChoise = MsgBox(str, vbYesNocancel) 'press YES many time to see transfer progresses
if nUserChoise = vbCancel then
bContinue = false
elseif nUserChoise = vbNO then
MySite.AbortAsync 'abort all tasks
bContinue = false
end if
wend
str = "DONE, Total: " & MySite.AsyncTaskNumber & strNL
for i = 0 to MySite.AsyncTaskNumber - 1 step 1
str = str & i & ": size: " & MySite.TransferredSize(i) & ", speed: " & MySite.Speed(i) & ", time left: " & MySite.TimeLeft(i) & ", status: " & MySite.Status(i) & strNL
next
MsgBox str
Related topics

Other properties


Checking the status of a transfer

Retrieving the status of a transfer

Description
Use the Status property to determine whether a transfer is active or it is already finished with success or error. This can be useful in combination with asynchronous commands or during an interactive script. The Status property will return a string.

Syntax
String Object.Status (long taskIdx)

Parameters

TaskIdx

This is the task index in the array of tasks created by asynchronous methods [0.. AsyncTaskNumber or - 1 (last started)]

Return Values
"WAIT" | Transfer action invoked but not initiated yet (followed by connecting)
"CANCELED" | Active transfer canceled by user
"FINISHED" | Transfer completed
"ERROR" | Error in transfer (any possible client or server error)
"SUSPENDED" | Added to queue but no transfer initiated yet
"SCHEDULED" | Item is scheduled for future transfer
"BLOCKED" | An internal status used for navigation and does not pertain to active or pending transfers. You can cancel any transfer requests in BLOCKED status without any ill effects.
"CHILDWAIT" | Condition when transfer item is waiting for a dependant item to finish transferring (*)
"SKIPPED" | Transfer skipped by user or automatically per overwrite rules
"CONNECTING" | Connecting to server (status right after WAIT)
"CANCELLING" | Cancel initiated but not completely stopped yet
"WORKING" | After connecting but before transferring. Could be opening data connection, or setting REST params, etc.
"TRANSFERRING" | File transfer in progress
"UNKNOWN" | Another string was returned other than one of the above. The string was unrecognized.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
If not CBool(MySite.IsPending) Then
MsgBox "Task done, final status is " + MySite.Status
End if
Related topics

Other properties


Checking if a server can resume downloads

Description
Use the RestSupport property to check if the server supports the REST (resume download) command.
Syntax
Boolean Object.RestSupport
Return values
1 | Server supports REST.
0 | Server does not support REST.
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
‘Initialize all necessary fields for MySite : host name, user, password, etc.
If (not cbool(MySite.RestSupport)) Then
MsgBox "This server doesn’t support the REST command"
End if
Related topics

Other properties


Retrieving a log as a string

Description
Use the Log property to return the entire log as a string which can be handled separately in your VB application or VB script.
Syntax
String Object.Log (long taskIdx)
Parameters

TaskIdx

This is the task index in the array of tasks created by asynchronous methods [0.. AsyncTaskNumber minus one, or - 1 (last asynchronous task started)]

It h as a default value of -1 = current task.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Host = "ftp://ftp.cuteftp.com"
MySite.Connect
MsgBox MySite.Log
Related topics

Other properties


Checking transfer progress

Description
Use the TotalSize, TransferredSize, Speed, TimeLeft, and TimeElapsed properties to determine a transfer's progress and various other aspects of the transfer.

Syntax
long Object.TotalSize (long taskIdx) = size in bytes
long Object.TransferredSize (long taskIdx) = size in bytes
long Object.Speed (long taskIdx) = bytes/second
long Object.TimeLeft (long taskIdx) = seconds
long Object.TimeElapsed (long taskIdx) =seconds

Parameters

TaskIdx

This is the task index in the array of tasks created by asynchronous methods [0.. AsyncTaskNumber minus one, or - 1 (last asynchronous task started)]

It h as a default value of - 1 = current task.

Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Host = host 'set all relavant host, login, pass, etc. properties
MySite.Download "aaa", "c:\temp"
MsgBox "Size: " & MySite.TotalSize & ", speed: " & MySite.Speed & ", time: " & MySite.TimeElapsed
Related topics

Checking if a transfer is active

Other properties


Retrieving file information

Description
Use the FileType, FileSize, and FileTimeModified properties to retrieve information about a particular item.
Syntax
long Object.FileType
long Object.FileSize
string Object.FileTimeModified
Return values

For FileType:

1 | Directory
2 | File
3 | Link

For FileSize:
the size in bytes of the file

For FileTimeModfied
mm/dd/yyyy hh:mm:ss
Example
Set fserv = CreateObject("CuteFTPPro.TEConnection")
strRemote = "somefilename.ext"
if cbool(fserv.RemoteExists(strRemote)) then
MsgBox "Remote file/folder info: Type=" & fserv.FileType & ", Size=" & fserv.fileSize & ", Date=" & fserv.FileTimeModified & strNL & "(type:1-dir,2-file,3-link)"
else
MsgBox "Error! " & fserv.ErrorDescription
End If
Related topics

Other properties


Including local files in lists and transfers

Description
Use the LocalFilterInclude property to set or retrieve the values for including local files or folders in transfers and listings. The string values may contain wildcards and you can add multiple filters by separating them with a semicolon ";".
Syntax
String Object.LocalFilterInclude
Example
MySite.LocalFilterInlcude = "*.jpg;*.gif"
Related topics

Other properties


Excluding local files from lists and transfers

Description
Use the LocalFilterExclude property to set and retrieve the values for excluding local files or folders from transfers and listings. The string values may contain wildcards and you can add multiple filters by separating them with a semicolon ";".
Syntax
String Object.LocalFilterExclude
Example
MySite.LocalFilterExclude = "*.mp3;*.jpg"
Related topics

Other properties


Excluding remote files from lists and transfers

Description
Use the RemoteFilterExclude property to set and retrieve the values for excluding remote files or folders from transfers and listings. The string values may contain wildcards and you can add multiple filters by separating them with a semicolon ";".
Syntax
String Object.RemoteFilterExclude
Example
MySite.RemoteFilterExclude = "*.txt;*.swp"
MySite.Download "*.*" ‘ will download all files except those with extensions of *.txt and *.swp
Related topics

Other properties


Including remote files in lists and transfers

Description
Use the RemoteFilterInclude property to set or retrieve the values used to include remote files or folders in transfers and listings. The string values may contain wildcards and you can add multiple filters by separating them with a semicolon ";".
Syntax
String Object.RemoteFilterInclude
Example
MySite.RemoteFilterInlcude = "*.jpg;*.gif"
Related topics

Other properties


Adding filters to the LIST command

Description
Use the RemoteSiteFilter property to specify a string which will be used as a filter parameter by the LIST command.
Syntax
string Object. RemoteSiteFilter
Example
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite. RemoteSiteFilter = "-l"
'This will send a "List -l" command to the server.
Note

These optional parameters to the list command are basically parameters passed to the UNIX ls program running on the server (if applicable):

-l | long listing
-a | show hidden files
-t | sort by timestamp
-R | recursive
There are various additional parameters. Refer to a UNIX manual or the Web for more details. You may want to check http://www.bsdi.com/bsdi-man.
Related topics

Other properties


High memory usage

If you leave the Transfer Engine running for extended lengths of time, it may begin to consume large amounts of memory. Set CuteFTP Pro to remove successful items from the queue to avoid this problem.

When you run many tasks, or schedule many recurring tasks, the successful tasks build up in the queue, unless you set CuteFTP Pro to automatically remove them. Each finished queue item takes about 500 bytes of memory until the Transfer Engine is closed.

To remove successful items from the queue

  1. Open the CuteFTP Pro user interface.

  2. On the menu bar click Tools > Global Options.

  3. Click Navigation Settings.

  4. Select the Remove successfully finished items from the queue automatically check box.

  5. Click OK. Successful items will be removed from the queue, even if you use the Transfer Engine without the user interface.

To remove successful items from the queue in a script

  • Use the TECommand method with DELETEFINISHED or DELETEALL property


 Absolute path

A designation of the location of a file which is given in relation to the root directory: it includes the root directory and the descending series of subdirectories leading to the end file. An absolute, or full, path begins with a slash. It contains the full directory of the item being referenced. Example: /pub/cuteftp


 Boolean
Of, pertaining to, or characteristic of logical (true, false) values. Many languages directly support a Boolean data type, with predefined values for true and false; others use integer data types to implement Boolean values, usually (although not always) with 0 equaling false and "not 0" equaling true.


Create a local folder example

CreateLocalFolder Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.CreateLocalFolder "c:\temp\New Folder"
'now check to see if it was created
MySite.LocalFolder = "c:\temp\New Folder"
currentdir = MySite.LocalFolder
MsgBox (currentdir)

Related Topics

CreateLocalFolder
Other method examples


Example for remote folder creation

CreateRemoteFolder Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")
'Specify user, pass if needed
MySite.Host = InputBox("Enter target host:", "CuteFTP Pro", "<your host name>")
if not MySite.Host = "" then
MySite.Connect
MySite.CreateRemoteFolder("/dir") 'creates /dir (because absolute path was used)
MySite.RemoteFolder = "/dir" 'now change to the newly create 'dir' folder
MySite.CreateRemoteFolder("dir2") 'creates /dir/dir2 (because relative path was used)
MySite.CreateRemoteFolder("/1/2/3/4/5") 'creates recursive dir /1/2/3/4/5
end if
MsgBox "Done"

Related topics

CreateRemoteFolder
Other method examples


TransferURLAsync sample script

TransferURLAsync Sample

Sub PasteURL()
Set Shell = CreateObject("WScript.Shell")
strDesktop = Shell.SpecialFolders("Desktop")
Dim fserv
Set fserv = CreateObject("CuteFTPPro.TEConnection")
nWaitEachXfer = MsgBox ("Would you like to wait for each transfer?", vbYesNo)
strNL = (Chr(13) & Chr(10))
MsgBox "The next prompt will offer you one of various methods in which to do specify the remote and local paths."
strURL = "ftp://ftp.cuteftp.com/pub/cuteftppro/cuteftppro.exe --> "&strDesktop& "\cuteftppro.exe"
While Not strURL = ""
strMsg = "Enter the URL using an extendent format." &strNL
strMsg = strMsg & "1) Download to the default folder: http://www.hostname.com" &strNL
strMsg = strMsg & "2) Download to specific folder: ftp://ftp.hostname.com --> c:\filename.ext" &strNL
strMsg = strMsg & "3) Upload to specific folder: ftp//ftp.host.com/path <-- c:\filename.ext" &strNL
strMsg = strMsg & "4) Site2site example: ftp://ftp.hostname.com <-> ftp://ftp.hostname2.com" &strNL
strURL = InputBox(strMsg, "CuteFTP Pro", strURL)
If Not strURL = "" Then
fserv.TransferURLAsync strURL
If nWaitEachXfer = vbYes Then
strStat = fserv.Wait()
MsgBox ("Finished status: " & strStat)
End If
End If
Wend
End Sub
PasteURL()

Related Topics

Other method examples

T ransferURLAsync
TransferURLAsync example


CHMOD Permissions

 About CHMOD Permissions

For your CGI program to run, it must be executable by your Internet server. Therefore, you must set the permissions so the server can read or execute your files, which usually means making your CGI programs world executable.
Set your file permissions by using the CHMOD commands. The CHMOD’s permission mask is a three-digit number.
Note that each digit of the number defines the permission for a different user of the file.
First digit: Defines the permissions for the owner.
Second digit: Defines the permissions for the group.
Third digit: Defines the permissions for everyone else (referred to as public).
Each digit works the same for each group of users: the owner, group, and public. What you set for one digit has no effect on the other two digits. Each digit is made up of the three Read, Write, and Execute permissions. The Read permission value is 4, the Write permission value is 2, and the Execute permission value is 1. These three numbers are added together to get the permissions for a file. If you want a file to only be readable and not writable or executable, set its permission to 4. This works the same for Write and Execute. Executable only files have a permission of 1.
EXAMPLE: If you want a file to have Read and Write permissions, add the Read and Write values together (4+2) and you get 6-the permissions setting for Read and Write. If you want the file to have Read, Write, and Execute permissions, use the value 7 (4+2+1). Do this for each of the three permission groups and you get a valid CHMOD mask. If you want your file to have Read, Write, and Execute permissions (4+2+1) for yourself; Read and Execute (4+1) for your group; and Execute (1) only for everyone else, you would set the file permissions to 751.


Concantenate

 Concatenate

To join sequentially (for example, to combine the two strings "hello" and "friend" into the single string "hello friend").
concatenated data set
A group of separate sets of related data treated as a single unit for processing.


Encrypting passwords

Use One Time Passwords (OTP) to protect your login password. MD4 and MD5 (S/Key) are password encryption schemes. When you connect with an encrypted password it is protected from interception. To use an encryption scheme it must be supported by the server.

Notes

Some FTP servers that support S/Key passwords are GlobalSCAPE Secure FTP Server, FTP Serv-U from Rhinosoft.com, and Unix WUftpd.

Encryption Options

Not Encrypted - the password is sent unprotected to the server.

MD4 (S/Key) - A system that encrypts your password a different way every time it is sent.

MD5 (S/Key) - The same system as MD4, with more complex encryption logarithms.


Finding servers that support FXP

Because FXP (site-to-site) transfers are considered a security risk, many servers do not support them or optionally decline to do so. The following table displays supporting servers.

Note

If the sites you are connecting are using SSH2 or SSL, transfers between them will not be secure.

BLUE servers must be present for a successful FXP transfer.

RED servers makes FXP transfers impossible.

BLACK servers can perform FXP transfers if a BLUE server is on the other side.

An FXP transfer with at least one RED server or two BLACK servers will fail.

You must configure the ProFTPD 1.2.3 Orc3 server, the wu-ftpd 2.6.0 server and the MS IIS 5.0 server to allow FXP.

Related topics

Transferring from site to site (FXP)

Setting up servers for FXP


 Integrated Development Environment (IDE)

A set of integrated tools for developing software. The tools are generally run from one user interface and consist of a compiler, an editor and a debugger.


 Relative path

A relative path assumes that your current working directory is the directory for the item being referenced. It does not begin with a backslash. Example: pub/cuteftp


Requirements

  • Windows 95/98/Me/NT/2000/XP

  • A Connection to the Internet

  • A registered copy of CuteFTP Pro or the TE SDK

  • At least some programming knowledge

  • Windows Scripting Host (WSH) installed: Included in Win98 and later

WSH was last available here:

http://www.microsoft.com/msdownload/vbscript/scripting.asp


 Secure Shell 2 (SSH2)

CuteFTP Pro allows for secured FTP connections over a Secure Shell 2 (SSH2) link. SSH is a protocol for secure remote login and other network services over an unsecured network. To perform SFTP/SSH2 connections, the remote system must be equipped with both SSH2 and an SFTP server, which is a component of SSH2.

The steps involved in opening an SSH2 connection are much more complicated than those involved in opening standard unsecured Internet connections. When the connection has been established, both sides determine the method of encryption through the use of a Diffie-Hellman key exchange sequence. Once both sides have determined the optimal encryption type to use, a session is granted and secured.

You can choose which encryption methods to use. The available encryption types are: Triple DES (3DES), ARCFOUR, Blowfish and Twofish. At least one encryption type should be selected. After the encryption method is established, the two systems are ready to exchange secure data. CuteFTP Pro will now send a secured FTP connection along the encrypted data tunnel, the remote system will respond and you can begin transferring files securely.

For more information on SSH2 go to the main CuteFTP Pro help file and choose Learning about SSH2 in the Security section.


 Secure Sockets Layer (SSL)

SSL is an open standard developed by Netscape Communications for establishing a secure communications channel to prevent the interception of critical information. SSL uses public key encryption.

For more detailed information on SSL, go to the main CuteFTP Pro Help and choose Learning about SSL in the Security section.


Setting up servers for FXP

FXP Server Setup

You have to set up the following three servers to allow site-to-site transfers.

To configure MS IIS to allow FXP

Requirements: MS IIS 5.0 with Windows 2000 SP1 or later
Information provided by Microsoft

Using regedit.exe add the following registry key (DWORD value)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\
EnablePortAttack=1

Warning: This DOES open your system to a port attack. Microsoft discourages this.

To configure ProFTPD 1.2.0rc3 to allow FXP

To support FXP when connecting as a user place "AllowForeignAddress on" in the Global or VirtualHost context.
To support FXP when connecting as anon you must place "AllowForeignAddress on" in the Anonymous context.

The config will happily support "AllowForeignAddress on" in multiple places within the config. You may need to add the following "PassivePorts 49152 65534"

To configure wu-ftpd to allow FXP

Requirements: wu-ftpd 2.6.0

/etc/ftpaccess

First, you need to add an additional class for users that are allowed to do FXP (unless you just want to use the predefined class "all"). If you add a new class, this line MUST be before the catch-all class "all", or the client will match class "all" first.

The line is of the form:
class {ArbitraryClassName} {AccessTypes} {HostAddrs} [HostAddrs]

Then you add lines to allow PASV and PORT commands to hosts whose IPs don't match the client (to allow FXP)

These lines are of the form:
port-allow {ArbitraryClassName} {HostAddrs}
pasv-allow {ArbitraryClassName} {HostAddrs}

Example

class newclass real,guest,anonymous *.mydomain.net
*.more.client.addresses.com
class all real,guest,anonymous *

port-allow newclass 0.0.0.0/0
pasv-allow newclass 0.0.0.0/0

This basically adds a new class (creatively called "newclass") - note that it appears BEFORE the line containing the class "all" - this new class contains all hosts in the subdomains mydomain.net and more.client.addresses.com (domains obviously made up by yours truly), in order to limit who we will allow to do FXP. The port-allow and pasv-allow lines basically allow FXP connections to anywhere if your client is in the class "newclass".

Related topics

Site-to-site transfers (FXP)

Finding servers that support FXP


Synchronization sample

Synchronize Sample

Sub syncURL()
Dim fserv
Set fserv = CreateObject("CuteFTPPro.TEConnection")
strHost = "ftp.yourhost.com"
strPath = "/pub"
strLocalPath = "c:\temp\sync_test"
strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
strLocalPath = InputBox("Enter local path", "CuteFTP Pro", strLocalPath)
fserv.Host = strHost
fserv.CaseHandling = 1
fserv.Recursive = false
fserv.IgnoreLinks = true
fserv.DeleteDestination = false
fserv.PromptDelete = true
nUserChoise = MsgBox ("Mirror remote: " & strHost & strPath & " to local " & strLocalPath & " ?", vbYesNoCancel)
If nUserChoise = vbYes Then
fserv.Synchronize strPath, strLocalPath, 1, 0
else
nUserChoise = MsgBox ("Mirror local: " & strHost & strLocalPath & " to remote " & strPath & " ?", vbYesNoCancel)
If nUserChoise = vbYes Then
fserv.Synchronize strPath, strLocalPath, 0, 0
else
nUserChoise = MsgBox ("Mirror both: " & strHost & strPath & " <- > " & strLocalPath & " ?", vbYesNoCancel)
If nUserChoise = vbYes Then
fserv.Synchronize strPath, strLocalPath, 2, 1
else
End if
End if
End if
End Sub
syncURL()
Related topics
Synchronizing folders


Wildcard masks

Wildcards

Wildcard masks are patterns of special characters used to filter file names. When a wildcard mask is matched against a file name, the two patterns are compared, letter-by-letter, from left to right until a mismatch occurs. If all the characters in both patterns compare positively, the file name matches the wildcard mask.

Wildcard mask characters

? | Will match any single character (i.e. ? will match a,b,c,1,2,etc...)
* | Will match any sequence of characters (including no characters at all), terminated by the next character in the mask. (i.e. * a will match cutea, wwwa, zzza, a etc.).
[ ] | Will match any character in the character set enclosed in the brackets. This can also be a range of characters (i.e. [A - Z] ). NOTE: If the opening bracket is followed by "!", it matches any character NOT in the set. (i.e. [abc] will match a,b or c only. [!abc] will match any character except a,b,c)

Wildcard mask examples

Mask | Will Match
* | all files
*bmp | sample.bmp, xyz.bmp, but not sample.gif
x?z | xyz, xaz, but not xyy
a[xyz]c | axc, ayc, azc, but not abc
a[!xyz]c | abc, adc, afc etc, but not axc
a[a-c]d | aad, abd, acd, but not axd


Writing a basic script

You can use most common programming and scripting languages (Java, VB Script, etc.) for communicating with the TE.

With the exception of some special function calls, the Pro TE will execute your script in a synchronous manner, meaning all steps are executed sequentially.

Creating and running scripts for non-programmers

Make sure the Pro TE has been registered and that all requirements are met.

  1. Open Microsfoft’s Notepad, GlobalSCAPE’s CuteHTML, or from the CuteFTP Pro interface, select Tools > Macros & Scripting > New Script.

  2. Copy and paste the code you need from the examples included in this Help file.

  3. Refer to Microsoft’s online documentation for help with the particular language syntax (msdn.microsoft.com) you are using.

  4. Save the finished file with the extension corresponding to the language you wrote the script in. Visual Basic Scripting (.vbs) is the default used in the sample code.

  5. Execute the script by double clicking it. If you receive an error, refer to the line number displayed by the error message to track down the cause. Refer to the Troubleshooting section for more help.

Note: If you have absolutely no programming experience but still want to use the Pro TE for some previously recorded macros created in earlier versions of CuteFTP, can you still run these macros from within the CuteFTP Pro main interface.

  1. Go to Tools Macros & Scripting > Run Existing Script

  2. Locate and select your previously recorded macro

  3. Click OPEN and the script will execute. You should also be able to execute it by simply double-clicking on the particular macro file on your system, if CuteFTP Pro has been previously associated with .mcr files.

Creating and running scripts for programmers

  1. Create a new script file using your favorite IDE.

  2. Use the included examples to get started if necessary or refer to the reference section of this document to learn the methods and properties supported.

  3. Save the file with the appropriate extension (.js, .vbs, etc.).

  4. Execute the file from the command line or as a scheduled event.

Note: The TE runs as a process, not a service, therefore you must be logged in to execute scripts.

Running a script from the command line

  1. Locate the path for the Pro TE

  2. From a command prompt, type:

[path_to_TE]\ftpte.exe /Script [scriptname].[ext]

Related topics

Setting up and registering the Transfer Engine

Reading the script examples

Using methods and properties